home *** CD-ROM | disk | FTP | other *** search
- /************************************************/
- /* Sample DLL's */
- /* Copyright © Vincent Parsons 1989. */
- /************************************************/
- /* DLL code for MPW C 3.0 or THINK C 4.0 */
- /* with Excel for the Macintosh 2.2 */
- /* and Microsoft C 5.1 */
- /* with Excel for Windows 2.1 */
- /************************************************/
- /* SampEIIE is an example of two data type I */
- /* inputs and one data type E output. The */
- /* output is the quotient of the two inputs. */
- /* A type E parameter is used to reserve space */
- /* for the returned value. */
- /************************************************/
- /* =REGISTER("SampDLLs","SampEIIE","EIIE") */
- /* for both the Mac and the PC. */
- /************************************************/
- /*
- A type E parameter is used to reserve storage
- space in an Excel data buffer for use by the
- DLL. No data is actually passed as type E.
-
- The function type is pascal double64 * on the
- Mac and double64 far * far pascal on the PC.
-
- On the Mac the returned value is d1 (a pointer
- to the double64 result) and the answer has
- been stored in the Excel buffer reserved by
- the input variable.
-
- On the PC the returned value is d1 (a double64
- result) and the answer has been stored in the
- Excel buffer reserved by the input variable.
-
- This was done so the REGISTER command is the
- same in the PC and the Mac.
- */
- /************************************************/
-
- #include "DLL.h"
-
- #if applec
- #include <Types.h>
-
- #elif MSDOS
- #include <windows.h>
-
- #endif
-
- #if THINK_C
- pascal double64 * main(short i1, short i2, double64 * d1); /* prototype */
-
- pascal double64 * main(i1, i2, d1)
- short i1;
- short i2;
- double64 * d1;
-
- #elif applec
- pascal double64 * SampEIIE(short i1, short i2, double64 * d1)
-
- #elif MSDOS
- double64 far pascal SampEIIE(short i1, short i2, double64 * d1)
- #endif
- {
- double64 answer;
-
- /* Returned parameter is the quotient of the two inputs */
- answer = (double64)i1/(double64)i2;
- *d1 = answer; /* Store value in Excel data buffer */
-
- #if applec | THINK_C
- return ( d1 );
- #elif MSDOS
- return ( (double64) *d1 );
- #endif
- }
-
- /************************************************/
-
-